package com.bitbakery.plugin.lisp.lang.formatting;

import com.bitbakery.plugin.lisp.lang.psi.CLFile;
import com.intellij.formatting.Indent;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class LispIndentProcessor {
    /**
     * Calculates indent, based on code style, between parent block and child node
     *
     * @param parent        parent block
     * @param child         child node
     * @param prevChildNode previous child node
     * @return indent
     */
    @NotNull
    public static Indent getChildIndent(@NotNull final LispBlock parent, @Nullable final ASTNode prevChildNode, @NotNull final ASTNode child) {
        final PsiElement psiParent = parent.getNode().getPsi();
        final PsiElement psiChild = child.getPsi();
        final IElementType childType = child.getElementType();

        if (psiParent instanceof CLFile) {
            return Indent.getNoneIndent();
        }

/*
        if (psiChild instanceof RHeredocValue || childType == tHEREDOC_END ||
                BNF.tBLOCK_COMMENT_TOKENS.contains(childType)) {
            return Indent.getAbsoluteNoneIndent();
        }


        if (childType == tLINE_COMMENT){
            if (psiParent instanceof RWrapAndIndentCOMPSTMT || psiParent instanceof RContainer) {
                return Indent.getNormalIndent();
            }
        }

        if (psiParent instanceof RIndentCOMPSTMT && psiChild instanceof RCompoundStatement) {
            return Indent.getNormalIndent();
        }
*/

        return Indent.getNoneIndent();
    }
}
